package com.zone.mapping;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * 存储mapper xml文件的信息
 *
 * @author: zongzi
 * @description: TODO
 * @date: 2023/12/4
 */
@Data
@NoArgsConstructor
public class MappedStatement {
    /**
     * sql类型
     */
    private SqlCommonType sqlCommonType;

    /**
     * mapper绑定的sql语句
     */
    private String boundSql;

    /**
     * mapper 接口全限定类名
     */
    private String namespace;
    /**
     * mapper 方法名
     */
    private String id;

    /**
     * 参数类型
     */
    private String paramsType;

    /**
     * 返回值类型
     */
    private String returnType;

    /**
     * sql中的参数值。
     * key = 第几个占位符，value具体的参数名称
     */
    private Map<Integer, String> params;

    public MappedStatement(SqlCommonType sqlCommonType, String namespace, String id, String parameterType, String resultType, String sql, Map<Integer, String> params) {
        this.sqlCommonType = sqlCommonType;
        this.namespace = namespace;
        this.id = id;
        this.paramsType = parameterType;
        this.returnType = resultType;
        this.boundSql = sql;
        this.params = params;
    }
}
